﻿package Space.Interface 
{
	import flash.display.Sprite;
	import org.aswing.*;
	import org.aswing.border.*;
	import org.aswing.geom.*;
	import org.aswing.colorchooser.*;
	import org.aswing.ext.*;

	public class ResourcesView extends Sprite
	{
		private var gameData:Array;
		private var WaterLabel:JLabel;
		private var Food:JLabel;
		private var Energy:JLabel;
		private var Minerals:JLabel;
		private var tempPanel:JPanel;
			
		public function ResourcesView(data:String) 
		{
			gameData = data.split(":");
			var tempLabel:JLabel;
			tempPanel = new JPanel();
			tempPanel.setSize(new IntDimension(450, 27));
			tempPanel.setLocationXY(5, 5);
			tempPanel.setBackground(new ASColor(0x3300, .5));
			tempPanel.setOpaque(true);
			var border0:LineBorder = new LineBorder();
			border0.setColor(new ASColor(0x6600, 1));
			tempPanel.setBorder(border0);
			var layout1:FlowLayout = new FlowLayout();
			layout1.setAlignment(AsWingConstants.LEFT);
			tempPanel.setLayout(layout1);
			
			tempLabel = new JLabel();
			tempLabel.setFont(new ASFont("Arial", 12, true, false, false, false));
			tempLabel.setForeground(new ASColor(0x9900, 1));
			tempLabel.setLocation(new IntPoint(5, 5));
			tempLabel.setSize(new IntDimension(50, 19));
			tempLabel.setHorizontalAlignment(AsWingConstants.RIGHT);
			tempLabel.setText("Water:");
			tempPanel.append(tempLabel);
			
			WaterLabel = new JLabel();
			WaterLabel.setFont(new ASFont("Arial", 12, true, false, false, false));
			WaterLabel.setForeground(new ASColor(0xffffff, 1));
			WaterLabel.setLocation(new IntPoint(52, 5));
			WaterLabel.setSize(new IntDimension(60, 19));
			WaterLabel.setHorizontalAlignment(AsWingConstants.LEFT);
			WaterLabel.setText(gameData[0]);
			//WaterLabel.setText("10000000");
			tempPanel.append(WaterLabel);

			tempLabel = new JLabel();
			tempLabel.setFont(new ASFont("Arial", 12, true, false, false, false));
			tempLabel.setForeground(new ASColor(0x9900, 1));
			tempLabel.setLocation(new IntPoint(105, 5));
			tempLabel.setSize(new IntDimension(50, 19));
			tempLabel.setHorizontalAlignment(AsWingConstants.RIGHT);
			tempLabel.setText("Food:");
			tempPanel.append(tempLabel);
			
			Food = new JLabel();
			Food.setFont(new ASFont("Arial", 12, true, false, false, false));
			Food.setForeground(new ASColor(0xffffff, 1));
			Food.setLocation(new IntPoint(152, 5));
			Food.setSize(new IntDimension(60, 19));
			Food.setHorizontalAlignment(AsWingConstants.LEFT);
			Food.setText(gameData[1]);
			//Food.setText("10000000");
			tempPanel.append(Food);

			tempLabel = new JLabel();
			tempLabel.setFont(new ASFont("Arial", 12, true, false, false, false));
			tempLabel.setForeground(new ASColor(0x9900, 1));
			tempLabel.setLocation(new IntPoint(204, 5));
			tempLabel.setSize(new IntDimension(60, 19));
			tempLabel.setHorizontalAlignment(AsWingConstants.RIGHT);
			tempLabel.setText("Energy:");
			tempPanel.append(tempLabel);
			
			Energy = new JLabel();
			Energy.setFont(new ASFont("Arial", 12, true, false, false, false));
			Energy.setForeground(new ASColor(0xffffff, 1));
			Energy.setLocation(new IntPoint(262, 5));
			Energy.setSize(new IntDimension(60, 19));
			Energy.setHorizontalAlignment(AsWingConstants.LEFT);
			Energy.setText(gameData[2]);
			//Energy.setText("10000000");
			tempPanel.append(Energy);
			
			tempLabel = new JLabel();
			tempLabel.setFont(new ASFont("Arial", 12, true, false, false, false));
			tempLabel.setForeground(new ASColor(0x9900, 1));
			tempLabel.setLocation(new IntPoint(322, 5));
			tempLabel.setSize(new IntDimension(60, 19));
			tempLabel.setHorizontalAlignment(AsWingConstants.RIGHT);
			tempLabel.setText("Minerals:");
			tempPanel.append(tempLabel);
			
			Minerals = new JLabel();
			Minerals.setFont(new ASFont("Arial", 12, true, false, false, false));
			Minerals.setForeground(new ASColor(0xffffff, 1));
			Minerals.setLocation(new IntPoint(381, 5));
			Minerals.setSize(new IntDimension(60, 19));
			Minerals.setHorizontalAlignment(AsWingConstants.LEFT);
			Minerals.setText(gameData[3]);
			//Minerals.setText("10000000");
			tempPanel.append(Minerals);

			addChild(tempPanel);

		}
		
		
	}
	
}